package com.example.cglibproxydemo;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * @Author: wyp
 * @Date: 2021/9/1 16:46
 */
public class PersonMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("AOP代理方法执行前的操作---------");
        Object invokeSuper = methodProxy.invokeSuper(o, objects);
        System.out.println("AOP代理方法执行后的操作---------");
        return invokeSuper;
    }
}
